﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UnitsAdmin.ascx.cs"
    Inherits="Micronet.OpenWeb.Com.ControlLib.UnitsAdmin" %>
<owc:OwGrid runat="server" ID="UnitsGrid" CellSpacing="0" DataSourceID="UnitsSDS"
    GridLines="None" OwEnableMessageDisplay="True" OwMessageDisplayType="Popup" AllowAutomaticDeletes="True"
    AllowAutomaticInserts="True" AllowAutomaticUpdates="True" SkinID="OwGridAdmin">
    <MasterTableView AutoGenerateColumns="False" CommandItemDisplay="Top" DataKeyNames="UnitID"
        DataSourceID="UnitsSDS" EditMode="EditForms">
        <CommandItemSettings ExportToPdfText="<%$ OwR:ExportToPDF %>" AddNewRecordText="<%$ OwR:AddNew %>"
            ExportToCsvText="<%$ OwR:ExportToCSV %>" ExportToExcelText="<%$ OwR:ExportToExcel %>"
            ExportToWordText="<%$ OwR:ExportToWord %>" RefreshText="<%$ OwR:Refresh %>">
        </CommandItemSettings>
        <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
            <HeaderStyle Width="20px"></HeaderStyle>
        </RowIndicatorColumn>
        <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
            <HeaderStyle Width="20px"></HeaderStyle>
        </ExpandCollapseColumn>
        <Columns>
            <owct:GridBoundColumn DataField="UnitID" DataType="System.Int64" FilterControlAltText="Filter UnitID column"
                HeaderText="<%$ OwR:ID %>" ReadOnly="True" SortExpression="UnitID" UniqueName="UnitID">
            </owct:GridBoundColumn>
            <owct:GridBoundColumn DataField="Name" FilterControlAltText="Filter Name column"
                HeaderText="<%$ OwR:UnitName %>" SortExpression="Name" UniqueName="Name">
            </owct:GridBoundColumn>
            <owct:GridBoundColumn DataField="UnitTypeID" FilterControlAltText="Filter UnitTypeID column"
                HeaderText="<%$ OwR:UnitType %>" SortExpression="UnitTypeID" UniqueName="UnitTypeID"
                DataType="System.Int64">
            </owct:GridBoundColumn>
            <owct:GridBoundColumn DataField="Description" FilterControlAltText="Filter Description column"
                HeaderText="<%$ OwR:DescriptionLabel %>" SortExpression="Description" UniqueName="Description">
            </owct:GridBoundColumn>
            <owct:GridEditCommandColumn ButtonType="ImageButton" EditImageUrl="<%$ OwI: CommandNameIcons/Edit.gif%>"
                UniqueName="EditCommandColumn2">
                <HeaderStyle Width="20px" />
            </owct:GridEditCommandColumn>
            <owct:GridButtonColumn ConfirmText="<%$ OwR:DoYouWantToDelete %>" ButtonType="ImageButton"
                CommandName="Delete" Text="<%$ OwR:Delete %>" UniqueName="DeleteColumn" ImageUrl="<%$ OwI: CommandNameIcons/Delete.gif%>">
                <HeaderStyle Width="20px" />
            </owct:GridButtonColumn>
        </Columns>
        <EditFormSettings EditFormType="Template" CaptionFormatString="Edit details for employee with ID {0}"
            CaptionDataField="CurrencyID">
            <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle>
            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
            </EditColumn>
            <PopUpSettings Width="100%" ScrollBars="Auto" />
            <FormTemplate>
                <fieldset>
                    <%--<legend>
                        <asp:Localize Text="<%$ OwR: CurrencyTypeManagement %>" runat="server"></asp:Localize>
                    </legend>--%>
                    <table class="ProductAdminTable">
                        <tr>
                            <td>
                                <asp:Localize Text="<%$ OwR: UnitName %>" runat="server"></asp:Localize>:
                            </td>
                            <td>
                                <owc:OwTextBox runat="server" ID="NameTextBox" Text='<%# Bind("Name") %>' SkinID="OwTextBox" />
                                <asp:RequiredFieldValidator runat="server" ID="NameRequiredFieldValidator" ErrorMessage="<%$ Ow: String.Format(Resources.OpenWeb.RequiredFieldValidatorErrMessage,Resources.OpenWeb.UnitName) %>"
                                    ControlToValidate="NameTextBox" Display="Dynamic" Text="*"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Localize Text="<%$ OwR: UnitType %>" runat="server"></asp:Localize>:
                            </td>
                            <td>
                                <owct:RadNumericTextBox ShowSpinButtons="true" IncrementSettings-InterceptArrowKeys="true"
                                    IncrementSettings-InterceptMouseWheel="true" DbValue='<%# Bind("UnitTypeID")%>'
                                    runat="server" ID="UnitTypeNumericTextBox" SkinID="RadNumericTextBox">
                                </owct:RadNumericTextBox>
                                <asp:RequiredFieldValidator runat="server" ID="CurrencyCodeRequiredFieldValidator"
                                    ErrorMessage="<%$ Ow: String.Format(Resources.OpenWeb.RequiredFieldValidatorErrMessage,Resources.OpenWeb.UnitType) %>"
                                    Text="*" ControlToValidate="UnitTypeNumericTextBox" Display="Dynamic"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Localize Text="<%$ OwR: DescriptionLabel %>" runat="server"></asp:Localize>:
                            </td>
                            <td>
                                <owc:OwTextBox runat="server" TextMode="MultiLine" ID="DescriptionTextBox" SkinID="DescriptionOwTextBox"
                                    Text='<%# Bind("Description") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                &nbsp;
                            </td>
                            <td>
                                <owc:OwButton ID="btnUpdateUpper" runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'
                                    Text='<%# (Container is GridEditFormInsertItem) ? Resources.OpenWeb.Insert : Resources.OpenWeb.Update%>'
                                    SkinID="OwButtonAdmin" CausesValidation="true" />
                                <owc:OwButton ID="btnCancelUpper" runat="server" CausesValidation="False" CommandName="Cancel"
                                    SkinID="OwButtonAdmin" Text='<%$ Ow: Resources.OpenWeb.Cancel %>' />
                            </td>
                        </tr>
                    </table>
                </fieldset>
            </FormTemplate>
        </EditFormSettings>
    </MasterTableView>
    <FilterMenu EnableImageSprites="False">
        <WebServiceSettings>
            <ODataSettings InitialContainerName="">
            </ODataSettings>
        </WebServiceSettings>
    </FilterMenu>
    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
        <WebServiceSettings>
            <ODataSettings InitialContainerName="">
            </ODataSettings>
        </WebServiceSettings>
    </HeaderContextMenu>
</owc:OwGrid>
<asp:SqlDataSource runat="server" ID="UnitsSDS" ConnectionString="<%$ ConnectionStrings:OwConnectionString %>"
    DeleteCommand="DELETE FROM [OpenWeb_Units] WHERE [UnitID] = @UnitID" InsertCommand="INSERT INTO [OpenWeb_Units] ([Name], [UnitTypeID], [Description]) VALUES (@Name, @UnitTypeID, @Description)"
    SelectCommand="SELECT * FROM [OpenWeb_Units]" UpdateCommand="UPDATE [OpenWeb_Units] SET [Name] = @Name, [UnitTypeID] = @UnitTypeID, [Description] = @Description WHERE [UnitID] = @UnitID">
    <DeleteParameters>
        <asp:Parameter Name="UnitID" Type="Int64" />
    </DeleteParameters>
    <InsertParameters>
        <asp:Parameter Name="Name" Type="String" />
        <asp:Parameter Name="UnitTypeID" Type="Int64" />
        <asp:Parameter Name="Description" Type="String" />
    </InsertParameters>
    <UpdateParameters>
        <asp:Parameter Name="Name" Type="String" />
        <asp:Parameter Name="UnitTypeID" Type="Int64" />
        <asp:Parameter Name="Description" Type="String" />
        <asp:Parameter Name="UnitID" Type="Int64" />
    </UpdateParameters>
</asp:SqlDataSource>
<asp:ValidationSummary HeaderText="<%$ OwR:ValidationSummaryHeaderText %>" ShowMessageBox="true"
    ID="ValidationSummary1" runat="server" ValidationGroup="" DisplayMode="BulletList"
    ShowSummary="false" />
